home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / tip / prot.tip < prev    next >
Text File  |  1993-09-15  |  2KB  |  73 lines

  1. % This macro source file is from the four volume series
  2. % "TeX in Practice" by Stephan von Bechtolsheim, published
  3. % 1993 by Springer-Verlag, New York.
  4. % Copyright 1993 Stephan von Bechtolsheim.
  5. % No warranty or liability is assumed.
  6. % This macro may be copied freely if no fees other than
  7. % media cost or shipping charges are charged and as long
  8. % as this copyright and the following source code itself
  9. % is not changed. Please see the series for further information.
  10. %
  11. % Version: 1.0
  12. % Date: May 1, 1993
  13. %
  14. %
  15. % This source code is documented in 29.6.1, p. III-525.
  16. % Original source in file "io2.TEX", starting line 1774.
  17. \wlog{L: "prot.tip" ["io2.TEX," l. 1774, p. III-525]}%
  18. % This file DOES belong to format "texip."
  19. \InputD{doloop.tip}
  20. \InputD{mspaces.tip}
  21. \catcode`\@ = 11
  22. \newif\ifProtWrite
  23. \ProtWritetrue
  24. \newcount\@ProtCount
  25. \newcount\@ProtCountX
  26. \newwrite\@ProtWrite
  27. \def\InitProtWrite{% 
  28.     \ifProtWrite
  29.         \immediate\openout\@ProtWrite = \jobname.prt
  30.     \fi
  31. }
  32. \def\CloseProtWrite{% 
  33.     \immediate\closeout\@ProtWrite
  34. }
  35. \def\WriteProtocol #1#2{%
  36.     \ifProtWrite
  37.         {% 
  38.             \@ProtCount = #1\relax
  39.             \def\@WriteSpace{}%
  40.             \DoLoop{\count1}{1}{1}{\@ProtCount}% 
  41.                 {\edef\@WriteSpace{\@WriteSpace\FourSpaces}}%
  42.             \immediate\write\@ProtWrite{\@WriteSpace #2}%
  43.         }%
  44.     \fi
  45. }
  46. \def\BoxToProtocol #1#2#3{% 
  47.     \ifProtWrite
  48.         {%
  49.             \WriteProtocol {#1}{\string\BoxToProtocol: #3}%
  50.             \@ProtCountX = #1\relax
  51.             \advance\@ProtCountX by 1
  52.             \ifvoid #2%
  53.                 \WriteProtocol{\@ProtCountX}{Box register #2
  54.                     is void.}%
  55.             \else
  56.                 \ifhbox #2%
  57.                     \WriteProtocol{\@ProtCountX}{Box register #2
  58.                         is an hbox.}%
  59.                 \else
  60.                     \WriteProtocol{\@ProtCountX}{Box register #2
  61.                         is a vbox.}%
  62.                 \fi
  63.             \fi
  64.             \ifvoid #2%
  65.             \else
  66.                 \WriteProtocol{\@ProtCountX}% 
  67.                     {Dimensions: (\the\ht#2+\the\dp#2)*\the\wd#2.}%
  68.             \fi
  69.         }%
  70.     \fi
  71. }
  72. \catcode`\@ = 12
  73.